package com.bynk.bynk_demo.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;
@Api(tags = "RestfulController", description = "RestFul风格测试")
@RestController
public class RestfulController {

        @ApiOperation("Gte id age")
        @GetMapping(value = "/student/{id}/{age}")
        public Object student(@PathVariable("id") Integer id,
                              @PathVariable("age") Integer age) {
            Map<String,Object> map=new HashMap<>();
            map.put("id",id);
            map.put("age",age);
            return map;
        }

        @DeleteMapping(value = "/student/detail/{id}/{status}")
        public Object student2(@PathVariable("id") Integer id,
                               @PathVariable("status") Integer status) {
            Map<String,Object> map=new HashMap<>();
            map.put("id",id);
            map.put("status",status);
            return map;
        }

        @DeleteMapping(value = "/student/{id}/detail/{phone}")
        public Object student3(@PathVariable("id") Integer id,
                               @PathVariable("phone") Integer phone) {
            Map<String,Object> map=new HashMap<>();
            map.put("id",id);
            map.put("phone",phone);
            return map;
        }

        @PostMapping(value = "/student/{id}")
        public String addStudent(@PathVariable("id") Integer id) {
            return "add student ID: " + id;
        }

        @PutMapping(value = "/student/{id}")
        public String updateStudent(@PathVariable("id") Integer id) {
            return "update student ID: " + id;
        }
    }

